import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 设备信息
 */
@Entity('device_info')
export class DeviceInfoEntity extends BaseEntity {
  @Index()
  @Column({ comment: '店铺ID' })
  storeId: number;

  @Column({ comment: '设备名称' })
  name: string;

  @Index({ unique: true })
  @Column({ comment: '设备物理地址', length: 50 })
  macAddress: string;

  @Column({ comment: '设备Http地址' })
  httpAddress: string;

  @Column({ comment: '设备状态', dict: ['启用', '禁用'], default: 0 })
  status: number;

  @Index()
  @Column({ comment: '设备归属人ID', nullable: true })
  ownerId: number;

  @Column({ comment: '最后心跳时间', nullable: true })
  lastHeartbeatTime: Date;

  @Column({ comment: '备注信息', nullable: true })
  remark: string;
}
